<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.container {
  display: inline-block;
  border: 2px solid black;
}
.parent {
  -webkit-mask-position: 30px 10px;
}
.target {
  width: 120px;
  height: 120px;
  background-image: url(../resources/stripes-100.png), url(../resources/blue-100.png);
  -webkit-mask-image: radial-gradient(20px circle at 20px 20px, black 18px, transparent),
                      radial-gradient(20px circle at 20px 20px, black 18px, transparent),
                      radial-gradient(20px circle at 20px 20px, black 18px, transparent),
                      radial-gradient(20px circle at 20px 20px, black 18px, transparent);
  -webkit-mask-position: 10px 30px;
}
</style>
<body>
<template id="target-template">
  <div class="container">
    <div class="target"></div>
  </div>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
// neutral
assertInterpolation({
  property: '-webkit-mask-position',
  from: neutralKeyframe,
  to: '20px 20px',
}, [
  {at: -0.25, is: '7.5px 32.5px, 7.5px 32.5px, 7.5px 32.5px, 7.5px 32.5px'},
  {at: 0, is: '10px 30px, 10px 30px, 10px 30px, 10px 30px'},
  {at: 0.25, is: '12.5px 27.5px, 12.5px 27.5px, 12.5px 27.5px, 12.5px 27.5px'},
  {at: 0.5, is: '15px 25px, 15px 25px, 15px 25px, 15px 25px'},
  {at: 0.75, is: '17.5px 22.5px, 17.5px 22.5px, 17.5px 22.5px, 17.5px 22.5px'},
  {at: 1, is: '20px 20px, 20px 20px, 20px 20px, 20px 20px'},
  {at: 1.25, is: '22.5px 17.5px, 22.5px 17.5px, 22.5px 17.5px, 22.5px 17.5px'},
]);

// initial
assertInterpolation({
  property: '-webkit-mask-position',
  from: 'initial',
  to: '20px 20px',
}, [
  {at: -0.25, is: '-5px -5px, -5px -5px, -5px -5px, -5px -5px'},
  {at: 0, is: '0% 0%, 0% 0%, 0% 0%, 0% 0%'},
  {at: 0.25, is: '5px 5px, 5px 5px, 5px 5px, 5px 5px'},
  {at: 0.5, is: '10px 10px, 10px 10px, 10px 10px, 10px 10px'},
  {at: 0.75, is: '15px 15px, 15px 15px, 15px 15px, 15px 15px'},
  {at: 1, is: '20px 20px, 20px 20px, 20px 20px, 20px 20px'},
  {at: 1.25, is: '25px 25px, 25px 25px, 25px 25px, 25px 25px'},
]);

// inherit
assertInterpolation({
  property: '-webkit-mask-position',
  from: 'inherit',
  to: '20px 20px',
}, [
  {at: -0.25, is: '32.5px 7.5px, 32.5px 7.5px, 32.5px 7.5px, 32.5px 7.5px'},
  {at: 0, is: '30px 10px, 30px 10px, 30px 10px, 30px 10px'},
  {at: 0.25, is: '27.5px 12.5px, 27.5px 12.5px, 27.5px 12.5px, 27.5px 12.5px'},
  {at: 0.5, is: '25px 15px, 25px 15px, 25px 15px, 25px 15px'},
  {at: 0.75, is: '22.5px 17.5px, 22.5px 17.5px, 22.5px 17.5px, 22.5px 17.5px'},
  {at: 1, is: '20px 20px, 20px 20px, 20px 20px, 20px 20px'},
  {at: 1.25, is: '17.5px 22.5px, 17.5px 22.5px, 17.5px 22.5px, 17.5px 22.5px'},
]);

// unset
assertInterpolation({
  property: '-webkit-mask-position',
  from: 'unset',
  to: '20px 20px',
}, [
  {at: -0.25, is: '-5px -5px, -5px -5px, -5px -5px, -5px -5px'},
  {at: 0, is: '0% 0%, 0% 0%, 0% 0%, 0% 0%'},
  {at: 0.25, is: '5px 5px, 5px 5px, 5px 5px, 5px 5px'},
  {at: 0.5, is: '10px 10px, 10px 10px, 10px 10px, 10px 10px'},
  {at: 0.75, is: '15px 15px, 15px 15px, 15px 15px, 15px 15px'},
  {at: 1, is: '20px 20px, 20px 20px, 20px 20px, 20px 20px'},
  {at: 1.25, is: '25px 25px, 25px 25px, 25px 25px, 25px 25px'},
]);

// Test equal number of position values as background images.
assertInterpolation({
  property: '-webkit-mask-position',
  from: '0px 0px, 0px 0px, 0px 0px, 0px 0px',
  to: '80px 80px, 80px 80px, 80px 80px, 80px 80px',
}, [
  {at: -0.25, is: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'},
  {at: 0, is:     '  0px   0px,   0px   0px,   0px   0px,   0px   0px'},
  {at: 0.25, is:  ' 20px  20px,  20px  20px,  20px  20px,  20px  20px'},
  {at: 0.5, is:   ' 40px  40px,  40px  40px,  40px  40px,  40px  40px'},
  {at: 0.75, is:  ' 60px  60px,  60px  60px,  60px  60px,  60px  60px'},
  {at: 1, is:     ' 80px  80px,  80px  80px,  80px  80px,  80px  80px'},
  {at: 1.25, is:  '100px 100px, 100px 100px, 100px 100px, 100px 100px'},
]);

// Test single position value repeated over background images.
assertInterpolation({
  property: '-webkit-mask-position',
  from: 'top 0px left 0px',
  to: 'left 80px top 80px',
}, [
  {at: -0.25, is: '-20px -20px, -20px -20px, -20px -20px, -20px -20px'},
  {at: 0, is:     '  0px   0px,   0px   0px,   0px   0px,   0px   0px'},
  {at: 0.25, is:  ' 20px  20px,  20px  20px,  20px  20px,  20px  20px'},
  {at: 0.5, is:   ' 40px  40px,  40px  40px,  40px  40px,  40px  40px'},
  {at: 0.75, is:  ' 60px  60px,  60px  60px,  60px  60px,  60px  60px'},
  {at: 1, is:     ' 80px  80px,  80px  80px,  80px  80px,  80px  80px'},
  {at: 1.25, is:  '100px 100px, 100px 100px, 100px 100px, 100px 100px'},
]);

// Test mismatched numbers of position values.
assertInterpolation({
  property: '-webkit-mask-position',
  from: '0px 0px, 80px 0px',
  to: '40px 40px, 80px 80px, 0px 80px',
}, [
  {at: -0.25, is: '-10px -10px, 80px -20px, 0px -20px, 90px -10px'},
  {at: 0, is:     '  0px   0px, 80px   0px, 0px   0px, 80px   0px'},
  {at: 0.25, is:  ' 10px  10px, 80px  20px, 0px  20px, 70px  10px'},
  {at: 0.5, is:   ' 20px  20px, 80px  40px, 0px  40px, 60px  20px'},
  {at: 0.75, is:  ' 30px  30px, 80px  60px, 0px  60px, 50px  30px'},
  {at: 1, is:     ' 40px  40px, 80px  80px, 0px  80px, 40px  40px'},
  {at: 1.25, is:  ' 50px  50px, 80px 100px, 0px 100px, 30px  50px'},
]);
</script>
</body>
